package com.parking.mgr.useraccount.controller;

import com.parking.mgr.common.annotion.BusinessLog;
import com.parking.mgr.common.annotion.LoginAuth;
import com.parking.mgr.common.annotion.PermissionUrl;
import com.parking.mgr.common.pojo.response.Result;
import com.parking.mgr.useraccount.model.param.LoginPasswordParam;
import com.parking.mgr.useraccount.service.LoginPasswordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @ClassName UserPasswordController
 * @Description 系统用户控制器
 * @Auther: zhijianpu
 * @Date: 2023/5/25
 */
@Api(value = "用户密码", tags = {"用户密码"})
@RequestMapping("/api/user/password")
@RestController
public class UserPasswordController {

    @Resource
    private LoginPasswordService loginPasswordService;

    @PostMapping("/add")
    @ApiOperation(value = "设置用户密码", notes = "设置用户密码", httpMethod = "POST")
    @BusinessLog(title = "设置用户密码")
    @LoginAuth
    @PermissionUrl
    public Result<?> addUserPassword(@RequestBody @Validated LoginPasswordParam loginPasswordParam, HttpServletRequest request) {
        loginPasswordService.addPassword(loginPasswordParam, request);
        return Result.success();
    }


//    @PostMapping("/edit")
//    @ApiOperation(value = "修改用户密码", notes = "修改用户密码", httpMethod = "POST")
//    public Result<?> changePassword(@RequestBody @Validated ChangePasswordParam changePasswordParam, HttpServletRequest request) {
//        loginPasswordService.changePassword(changePasswordParam, request);
//        return Result.success();
//    }
}
